import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import AutoImport from 'unplugin-auto-import/vite';

export default defineConfig({
	plugins: [ 
		uni(),
		AutoImport({
			imports:[
				// 自定义预设
				{
					'@/store/login': ['loginStore'],
					'@/store/setups': ['setupsStore'],
					'@/store/upload': ['uploadStore'],
				}
			]
		}) 
	],
	server: {
		port: 5173,
		host: '0.0.0.0',
		proxy: {
			'/unDev': {
				// target: 'https://serviceapi.aibanaba.com', // api主机
				target: 'https://tserviceapi.aibanaba.com', // api主机
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/unDev/, ''),
			},
			'/un-dev': {
				target: 'https://qaengine-2.aibanaba.com', // api主机
				// target: 'https://qaengine.lw4ever.net', // api主机
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/un-dev/, ''),
			},
			'/dev': {
				// target: 'https://webapi.aibanaba.com', // api主机
				target: 'https://twebapi.aibanaba.com', // api主机
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/dev/, ''),
			},
			'/audio-dev': {
				// target: 'https://webapi.aibanaba.com', // api主机
				target: 'https://aibanaba.blob.core.windows.net', // api主机
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/audio-dev/, ''),
			},
		}
	}
});